package Pojo;

import java.util.Objects;

//订单实体类
public class Order {
    private Integer order_id;//订单id（主键）
    private String order_number;//订单编号
    private Integer uid;//用户id（用户表主键）
    private Integer client_id;//客户id（客户表主键）
    private Integer order_status_id;//订单状态id（订单状态表主键）


    //下面的属性用于mybatis表关系查询，一对一，一对多，多对多
    private User user;//用户实体类对象
    private Client client;//客户实体类对象
    private OrderDetails orderDetails;

    public Order() {
    }

    @Override
    public String toString() {
        return "Order{" +
                "order_id=" + order_id +
                ", order_number='" + order_number + '\'' +
                ", uid=" + uid +
                ", client_id=" + client_id +
                ", order_status_id=" + order_status_id +
                ", user=" + user +
                ", client=" + client +
                ", orderDetails=" + orderDetails +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Order order = (Order) o;
        return Objects.equals(order_id, order.order_id) &&
                Objects.equals(order_number, order.order_number) &&
                Objects.equals(uid, order.uid) &&
                Objects.equals(client_id, order.client_id) &&
                Objects.equals(order_status_id, order.order_status_id) &&
                Objects.equals(user, order.user) &&
                Objects.equals(client, order.client) &&
                Objects.equals(orderDetails, order.orderDetails);
    }

    @Override
    public int hashCode() {
        return Objects.hash(order_id, order_number, uid, client_id, order_status_id, user, client, orderDetails);
    }

    public Integer getOrder_id() {
        return order_id;
    }

    public void setOrder_id(Integer order_id) {
        this.order_id = order_id;
    }

    public String getOrder_number() {
        return order_number;
    }

    public void setOrder_number(String order_number) {
        this.order_number = order_number;
    }

    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    public Integer getClient_id() {
        return client_id;
    }

    public void setClient_id(Integer client_id) {
        this.client_id = client_id;
    }

    public Integer getOrder_status_id() {
        return order_status_id;
    }

    public void setOrder_status_id(Integer order_status_id) {
        this.order_status_id = order_status_id;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }

    public OrderDetails getOrderDetails() {
        return orderDetails;
    }

    public void setOrderDetails(OrderDetails orderDetails) {
        this.orderDetails = orderDetails;
    }

    public Order(Integer order_id, String order_number, Integer uid, Integer client_id, Integer order_status_id, User user, Client client, OrderDetails orderDetails) {
        this.order_id = order_id;
        this.order_number = order_number;
        this.uid = uid;
        this.client_id = client_id;
        this.order_status_id = order_status_id;
        this.user = user;
        this.client = client;
        this.orderDetails = orderDetails;
    }
}
